package config

import "runtime"

type CollectionConfig struct {
	Game         string // 游戏
	Promote      string // 推广
	Trade        string // 交易
	User         string // 用户
	UserAddress  string // 用户收货地址
	LogUserLogin string // 用户登录日志
	LogIntegral  string // 积分进出日志
	Goods        string // 积分可以兑换的商品
	IntegralTask string // 积分任务
	Order        string // 交易订单
	Prizes       string // 奖品列表
	Set          string // 系统设置
	LogShare     string // 邀请日志
}

type DbConfig struct {
	DbHost      string
	DbName      string
	DbConnStr   string
	Collection  CollectionConfig
	BackupEmail string
	BackupPath  func() string
}

var Db = &DbConfig{
	DbHost:    "mongodb://localhost:27017",
	DbName:    "higame",
	DbConnStr: "mongodb://localhost:27017/higame",
	Collection: CollectionConfig{
		Game:         "game",
		Promote:      "promote",
		Trade:        "trade",
		User:         "user",
		UserAddress:  "user_address",
		LogUserLogin: "log_user_login",
		LogIntegral:  "log_integral",
		Goods:        "goods",
		IntegralTask: "integral_task",
		Order:        "order",
		Prizes:       "prizes",
		Set:          "set",
		LogShare:     "log_share",
	},
	BackupEmail: "igufei@qq.com",
	BackupPath: func() string {
		platform := runtime.GOOS
		if platform == "windows" {
			return "C:/IGF/Data/backup/"
		} else if platform == "linux" {
			return "/data/backup/"
		} else {
			return ""
		}
	},
}
